/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
	AsyncStorage,
	StyleSheet,
	View,
} from 'react-native';
// 路由 
import {
	StackNavigator,
	TabNavigator,
} from 'react-navigation';
// 手机
import PhoneLoginScene from './user/phoneLoginScene';
//添加好友
import addFriendScene from './friendCircle/addFriendScene';
//账号
import AccountLoginScene from './user/accountLoginScene';
// 注册
import RegisterScene from './user/registerScene';
// 登陆
import LoginState from './user/loginState';
// // tab加载页
// import TabLoadingScene from './other/tabLaddingScene'
//设置
import SettingScene from './other/settingScene'
import HomeScene from './home/homeScene';
//消息通知
import NoTroubleScene from './other/noTroubleScene'
//加号弹出框
import MorePopWidows from './ui/MorePopWidows';
//二维码
import MyQRcodeScene from './user/myQRcodeScene'
// 个人中新
import UserInfoScene from './user/userInfoScene'
// 收藏
import CollectScene from './user/collectScene'
// 首页tab分页
import ChatScene from './chatShip/chatScene'
import MySceme from './home/myScene';
import HomeTab from './ui/homeTab';
import HeaderTitle from './ui/headerTitle';

//我的群组
import myGroupChatScene from './user/myGroupChatScene'
//钱包
import walletScene from './user/walletScene'
//好友信息页
import FriendInfoScene from './friendCircle/friendInfo'
//隐私设置
import PrivacyScene from './other/privacyScene'
//聊天设置
import ChattingScene from './other/chattingScene'
import SearchScene from './home/searchScene';
//关于
import AboutScene from './other/aboutScene'
// 朋友圈
import FriendCircleHeader from './ui/friendCircleHeader';
import FriendCircleScnen from './friendCircle/friendCircleScene';
// 聊天列表
import ChatListScene from './home/chatListScene';
//聊天信息
import chatInfoScene from './friendCircle/chatInfo';
//联系人列表
import FriendScene from './home/friendScene';
// 发现页
import DiscoverScene from './home/discoverScene';
// icon
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons';
import Entypo from 'react-native-vector-icons/Feather';
type Props = {};

// 数据存储
import Storage from 'react-native-storage';

//	储存

var storage = new Storage({
  // 最大容量，默认值1000条数据循环存储
  size: 1000,

  // 存储引擎：对于RN使用AsyncStorage，对于web使用window.localStorage
  // 如果不指定则数据只会保存在内存中，重启后即丢失
  storageBackend: AsyncStorage,
    
  // 数据过期时间，默认一整天（1000 * 3600 * 24 毫秒），设为null则永不过期
  defaultExpires: null,
    // defaultExpires: 1000 * 3600 * 24,
  // 读写时在内存中缓存数据。默认启用。
  enableCache: true,
    
  // 如果storage中没有相应数据，或数据已过期，
  // 则会调用相应的sync方法，无缝返回最新数据。
  // sync方法的具体说明会在后文提到
  // 你可以在构造函数这里就写好sync的方法
  // 或是在任何时候，直接对storage.sync进行赋值修改
  // 或是写到另一个文件里，这里require引入
//   sync: require('你可以另外写一个文件专门处理sync')    
  	
})  
global.storage = storage;
var title = "随聊"
export default class App extends Component<Props> {
	
	constructor(props) {
		super(props)
	}

	render() {
		
		return (
			<Apps  />
		);
	}
}

//首页tab参数
const HomeTabs = TabNavigator({
	msgList: {
		screen: ChatListScene,
		navigationOptions: {
			title: '随聊',
			tabBarIcon: ({ focused, tintColor }) => {
				return (
					<View>
						<View style={styles.msgNote}>
                        </View>
						<SimpleLineIcons name='bubbles' size={20} color={focused ? "#10B1F6" : "#a5a5a5"}></SimpleLineIcons>
					</View>
				);
			},
		},
	},
	friend: {
		screen: FriendScene,
		navigationOptions: {
			title: '通讯录',
			tabBarIcon: ({ focused, tintColor }) => {
				return (
					<View>
						{/* <Text></Text> */}
						<SimpleLineIcons name='people' size={20} color={focused ? "#10B1F6" : "#a5a5a5"}></SimpleLineIcons>
					</View>
				);
			},
		},
	},
	discover: {
		screen: DiscoverScene,
		navigationOptions: {
			title: '发现',
			tabBarIcon: ({ focused, tintColor }) => {
				return (
					<View>
						<SimpleLineIcons name='puzzle' size={20} color={focused ? "#10B1F6" : "#a5a5a5"}></SimpleLineIcons>
					</View>
				);
			},
		},
	},
	my: {
		screen: MySceme,
		navigationOptions: {
			title: '我的',
			tabBarIcon: ({ focused, tintColor }) => {
				return (
					<View>
						<SimpleLineIcons name='user' size={20} color={focused ? "#10B1F6" : "#a5a5a5"}></SimpleLineIcons>
					</View>
				);
			},
		},
	},

}, {
	tabBarOptions: {
		activeTintColor: '#10B1F6',
		inactiveTintColor: '#999999',
		showIcon: true,
		labelStyle: {
			fontSize: 12,
			marginTop: 0,
			marginBottom: 0,
		},
		style: {
			marginBottom: -2,
			backgroundColor: '#FCFCFC',
			// color: 'rgb(25,177,249)',
		},
	},
	lazy: true,
	trueinitialRouteName: 'msgList',
	tabBarPosition: 'bottom',
});

	// 页面导航
const Apps = StackNavigator({
	loginState: {
		screen: LoginState,
		navigationOptions: {
			header: null,
		},
		mode: {
			card: null
		},

	},
	phoneLogin: {
		screen: PhoneLoginScene,
		navigationOptions: {
			header: null,
		},
		// navigationOptions: {
		// 	headerTitle: '登陆',
		// 	headerTitleStyle: {
		// 		fontSize: 16,
		// 		color: "rgb(70,70,70)",
		// 	},
		// 	headerStyle:{
		// 		elevation: 0,
		// 		shadowOpacity: 0,
		// 		borderBottomWidth:1,
        // 		borderColor: '#f9f9f9'
		// 	}
		// },
		mode: null,

	},
	accountLogin: {
		screen: AccountLoginScene,
		navigationOptions: {
			header: null,
		},
		mode: null,
	},
	userInfo: {
		screen: UserInfoScene,
		navigationOptions: {
			headerTitle: '个人信息',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	walletScene: {
		screen: walletScene,
		navigationOptions: {
			headerTitle: '钱包',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	myGroupChatScene: {
		screen: myGroupChatScene,
		navigationOptions: {
			headerTitle: '我的群组',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	chatInfoScene: {
		screen: chatInfoScene,
		navigationOptions: {
			headerTitle: '聊天设置',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	friendInfo: {
		screen: FriendInfoScene,
		navigationOptions: {
			headerTitle: '详细资料',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	myQRcode: {
		screen: MyQRcodeScene,
		navigationOptions: {
			headerTitle: '我的二维码',
			headerTitleStyle: {
				fontSize: 16,
			},
			headerTintColor: '#fff',
			headerStyle:{
				color: "#fff",
				
				backgroundColor: '#5A5A5A',
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	collect: {
		screen: CollectScene,
		navigationOptions: {
			headerTitle: '收藏',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	notrouble: {
		screen: NoTroubleScene,
		navigationOptions: {
			headerTitle: '消息通知',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	about: {
		screen: AboutScene,
		navigationOptions: {
			headerTitle: '关于',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle: {
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	chatting: {
		screen: ChattingScene,
		navigationOptions: {
			headerTitle: '聊天设置',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle: {
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	privacy: {
		screen: PrivacyScene,
		navigationOptions: {
			headerTitle: '隐私安全',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle: {
				elevation: 0,
				shadowOpacity: 0,
			}
		},
		mode: null,
	},
	registerScene: {
		screen: RegisterScene,
		navigationOptions: {
			// headerTitle: '注册',
			// headerTitleStyle: {
			// 	fontSize: 16,
			// 	color: "rgb(70,70,70)",
			// },
			// headerStyle: {
			// 	elevation: 0,
			// 	shadowOpacity: 0,
			// 	borderBottomWidth: 1,
			// 		borderColor: '#f9f9f9'
			// }
			header: null,
		},
		mode: null,
	},
	settingScene: {
		screen: SettingScene,
		navigationOptions: {
			headerTitle: '设置',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
				borderBottomWidth: .6,
				borderColor: 'rgb(240,240,240)',
			}
		},
		mode: null,
	},
	addFriendScene: {
		screen: addFriendScene,
		navigationOptions: {
			headerTitle: '添加好友',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerStyle:{
				elevation: 0,
				shadowOpacity: 0,
				borderBottomWidth: .6,
				borderColor: 'rgb(240,240,240)',
			}
		},
		mode: null,
	},
	searchScene: {
		screen: SearchScene,
		navigationOptions: {
			header: null,
		},
		mode: null,
	},
	chatScene: {
		screen: ChatScene,
		navigationOptions: {
			header: null,
		},
		mode: null,
	},
	appScece: {
		screen: App,
		navigationOptions: {
			header: null,
		},
		mode: null,
	},
	homeScene: {
		screen: HomeTabs,
		navigationOptions: {
			// header: {
			// 	title:'随聊',
			// },
			headerTitle: '随聊',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(40,40,40)",
			},
			headerStyle: {
				elevation: 0,
				borderBottomWidth:.6,
				borderColor:'rgb(240,240,240)',
			},
			headerLeft:null,
			headerRight:(
				<HomeTab 
				/>
			),
			headerTintColor: "#333",
		},
		mode: null,
	},
	addFriendScene: {
		screen: addFriendScene,
		navigationOptions: {
			headerTitle: '添加好友',
			headerTruncatedBackTitle:'返回',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
				
			},
			headerStyle: {
				elevation: 0,
				borderBottomWidth:.6,
				borderColor:'rgb(240,240,240)',
			},
		},
		mode: null,
	},
	friendCircleScene: {
		screen: FriendCircleScnen,
		navigationOptions: {
			headerTitle: '朋友圈',
			headerTruncatedBackTitle:'返回',
			headerTitleStyle: {
				fontSize: 16,
				color: "rgb(70,70,70)",
			},
			headerRight: (
				<FriendCircleHeader />
			),
		},
		mode: null,
	},
	
});
const styles = StyleSheet.create({

	text: {
		fontSize: 16,
		color: '#ffffff',
		justifyContent: 'center',
	},
	iconStyle: {
		width: 22,
		height: 22,
	},
	action: {
		flexDirection: 'row',
		justifyContent: 'center',
		alignItems: 'center',
	},
	scanIcon: {
		width: 28,
		height: 28,
		alignItems: 'center',
		marginLeft: 10,
	},
	scanText: {
		fontSize: 14,
		color: '#ffffff',
		justifyContent: 'center',
		alignItems: 'center',
	},
	//⚪点
	msgNote: {
			position: 'absolute',
			// right: 10,
			backgroundColor: 'red',
			alignSelf: 'flex-end',
			justifyContent: 'center',
			width: 10,
			height: 10,
			zIndex: 1,
			borderTopLeftRadius: 20,
			borderTopRightRadius: 20,
			borderBottomLeftRadius: 20,
			borderBottomRightRadius: 20,
		},
		
});

